{% extends '@Admin/adminFramework/example/list.html.twig' %}
{% import "@Admin/adminFramework/loader/model.loader.twig" as loader_model %}
{% import "@Admin/adminFramework/loader/base.loader.twig" as loader_base %}
{% import "@Admin/adminFramework/loader/control.loader.twig" as loader_control %}

{% block action %}
    {% block action_insert %}
        {{ loader_control.a('添加', 'button', 'btn btn-success btn-add', ' href="' ~ path('admin_role_show') ~ '" ') | raw }}
    {% endblock %}
{% endblock %}


{% block before %}
    {{ loader_model.load_navigation('角色列表', '权限管理', { '角色列表': '' }) }}
{% endblock %}


{% block title %}列表{% endblock %}

{% block filtrate %}
{% endblock %}

{% block th %}
    <th>序号</th>
    <th>标识</th>
    <th>角色</th>
    <th width="35%">操作</th>
{% endblock %}

{% block td %}
    <td>{{ item + 1 }}</td>
    <td>{{ value.name }}</td>
    <td>{{ value.description }}</td>
    <td>
        {{ loader_control.a('编辑', '', 'btn btn-info btn-update', 'href="' ~ path('admin_role_show', {name: value.name}) ~ '"') }}
        {{ loader_control.buttonDelete('删除', 'data-url="' ~ path('admin_role_delete', {name: value.name}) ~ '"', 'edit_disable') }}
        {{ loader_control.a('权限分配', '', 'btn btn-success', 'href="' ~ path('admin_role_children', {name: value.name}) ~ '"') }}
    </td>
{% endblock %}

{% block jquery %}
    {{ parent() }}
    <script>
        $('.btn-delete').click(function() {
            $.ajax({
                url: $(this).data('url'),
                type: 'delete',
                success: function (result) {
                    resultPreprocess(result, undefined ,function() {
                        window.location.reload();
                    });
                }
            })
        })
    </script>

{% endblock %}